
[dbo].[sp_asi_FolderPath]
CREATE PROCEDURE sp_asi_FolderPath
@currentfolder int
AS
DECLARE @currentparent int,
@folderpath varchar(2048)
SET @currentparent = (SELECT FOLDER_PARENT FROM Cmty_Shared_Folders WHERE FOLDER_SEQ=@currentfolder)
SET @folderpath = LTRIM(STR(@currentfolder))
WHILE @currentparent > 0
BEGIN
SET @folderpath = STUFF(@folderpath, 1, 0, LTRIM(STR(@currentparent) + '\'))
SET @currentfolder = @currentparent
SET @currentparent = (SELECT FOLDER_PARENT FROM Cmty_Shared_Folders WHERE FOLDER_SEQ=@currentfolder)
END
select @folderpath as FOLDERPATH
RETURN
GO
GRANT EXECUTE ON [dbo].[sp_asi_FolderPath] TO [IMIS]
GO